Optimal. Leaf size=131 \[ \frac {a^2 (c+d x)^2}{2 d}-\frac {4 i a b (c+d x) \text {ArcTan}\left (e^{i (e+f x)}\right )}{f}+\frac {b^2 d \log (\cos (e+f x))}{f^2}+\frac {2 i a b d \text {PolyLog}\left (2,-i e^{i (e+f x)}\right )}{f^2}-\frac {2 i a b d \text {PolyLog}\left (2,i e^{i (e+f x)}\right )}{f^2}+\frac {b^2 (c+d x) \tan (e+f x)}{f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 131, normalized size of antiderivative = 1.00, number of steps
used = 9, number of rules used = 6, integrand size = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {4275, 4266,
2317, 2438, 4269, 3556} \begin {gather*} \frac {a^2 (c+d x)^2}{2 d}-\frac {4 i a b (c+d x) \text {ArcTan}\left (e^{i (e+f x)}\right )}{f}+\frac {2 i a b d \text {Li}_2\left (-i e^{i (e+f x)}\right )}{f^2}-\frac {2 i a b d \text {Li}_2\left (i e^{i (e+f x)}\right )}{f^2}+\frac {b^2 (c+d x) \tan (e+f x)}{f}+\frac {b^2 d \log (\cos (e+f x))}{f^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2317
Rule 2438
Rule 3556
Rule 4266
Rule 4269
Rule 4275
Rubi steps
\begin {align*} \int (c+d x) (a+b \sec (e+f x))^2 \, dx &=\int \left (a^2 (c+d x)+2 a b (c+d x) \sec (e+f x)+b^2 (c+d x) \sec ^2(e+f x)\right ) \, dx\\ &=\frac {a^2 (c+d x)^2}{2 d}+(2 a b) \int (c+d x) \sec (e+f x) \, dx+b^2 \int (c+d x) \sec ^2(e+f x) \, dx\\ &=\frac {a^2 (c+d x)^2}{2 d}-\frac {4 i a b (c+d x) \tan ^{-1}\left (e^{i (e+f x)}\right )}{f}+\frac {b^2 (c+d x) \tan (e+f x)}{f}-\frac {(2 a b d) \int \log \left (1-i e^{i (e+f x)}\right ) \, dx}{f}+\frac {(2 a b d) \int \log \left (1+i e^{i (e+f x)}\right ) \, dx}{f}-\frac {\left (b^2 d\right ) \int \tan (e+f x) \, dx}{f}\\ &=\frac {a^2 (c+d x)^2}{2 d}-\frac {4 i a b (c+d x) \tan ^{-1}\left (e^{i (e+f x)}\right )}{f}+\frac {b^2 d \log (\cos (e+f x))}{f^2}+\frac {b^2 (c+d x) \tan (e+f x)}{f}+\frac {(2 i a b d) \text {Subst}\left (\int \frac {\log (1-i x)}{x} \, dx,x,e^{i (e+f x)}\right )}{f^2}-\frac {(2 i a b d) \text {Subst}\left (\int \frac {\log (1+i x)}{x} \, dx,x,e^{i (e+f x)}\right )}{f^2}\\ &=\frac {a^2 (c+d x)^2}{2 d}-\frac {4 i a b (c+d x) \tan ^{-1}\left (e^{i (e+f x)}\right )}{f}+\frac {b^2 d \log (\cos (e+f x))}{f^2}+\frac {2 i a b d \text {Li}_2\left (-i e^{i (e+f x)}\right )}{f^2}-\frac {2 i a b d \text {Li}_2\left (i e^{i (e+f x)}\right )}{f^2}+\frac {b^2 (c+d x) \tan (e+f x)}{f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(566\) vs. \(2(131)=262\).
time = 4.36, size = 566, normalized size = 4.32 \begin {gather*} \frac {-a^2 (e+f x) (-2 c f+d (e-f x))+\frac {2 b^2 f (c+d x) \sin \left (\frac {1}{2} (e+f x)\right )}{\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )}+\frac {2 b^2 f (c+d x) \sin \left (\frac {1}{2} (e+f x)\right )}{\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )}+\frac {2 b \left (-b d \log \left (\sec ^2\left (\frac {1}{2} (e+f x)\right )\right )+(b d+2 a d e-2 a c f) \log \left (1-\tan \left (\frac {1}{2} (e+f x)\right )\right )+(b d-2 a d e+2 a c f) \log \left (1+\tan \left (\frac {1}{2} (e+f x)\right )\right )-2 i a d \left (\log \left (1+i \tan \left (\frac {1}{2} (e+f x)\right )\right ) \log \left (\left (\frac {1}{2}-\frac {i}{2}\right ) \left (1+\tan \left (\frac {1}{2} (e+f x)\right )\right )\right )+\text {PolyLog}\left (2,\frac {1}{2} \left ((1+i)-(1-i) \tan \left (\frac {1}{2} (e+f x)\right )\right )\right )\right )+2 i a d \left (\log \left (1+i \tan \left (\frac {1}{2} (e+f x)\right )\right ) \log \left (\left (-\frac {1}{2}-\frac {i}{2}\right ) \left (-1+\tan \left (\frac {1}{2} (e+f x)\right )\right )\right )+\text {PolyLog}\left (2,\left (\frac {1}{2}+\frac {i}{2}\right ) \left (-i+\tan \left (\frac {1}{2} (e+f x)\right )\right )\right )\right )+2 i a d \left (\log \left (1-i \tan \left (\frac {1}{2} (e+f x)\right )\right ) \log \left (\left (\frac {1}{2}+\frac {i}{2}\right ) \left (1+\tan \left (\frac {1}{2} (e+f x)\right )\right )\right )+\text {PolyLog}\left (2,\left (-\frac {1}{2}-\frac {i}{2}\right ) \left (i+\tan \left (\frac {1}{2} (e+f x)\right )\right )\right )\right )-2 i a d \left (\log \left (1-i \tan \left (\frac {1}{2} (e+f x)\right )\right ) \log \left (\left (-\frac {1}{2}+\frac {i}{2}\right ) \left (-1+\tan \left (\frac {1}{2} (e+f x)\right )\right )\right )+\text {PolyLog}\left (2,\left (\frac {1}{2}-\frac {i}{2}\right ) \left (i+\tan \left (\frac {1}{2} (e+f x)\right )\right )\right )\right )\right ) (-2 a f (c+d x)+b d \sin (e+f x))}{2 a \left (d e-c f-i d \log \left (1-i \tan \left (\frac {1}{2} (e+f x)\right )\right )+i d \log \left (1+i \tan \left (\frac {1}{2} (e+f x)\right )\right )\right )+b d \sin (e+f x)}}{2 f^2} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.56, size = 232, normalized size = 1.77
method | result | size |
derivativedivides | \(\frac {a^{2} c \left (f x +e \right )-\frac {a^{2} d e \left (f x +e \right )}{f}+\frac {a^{2} d \left (f x +e \right )^{2}}{2 f}+2 a b c \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )-\frac {2 a b d e \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{f}+\frac {2 a b d \left (-\left (f x +e \right ) \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right )+\left (f x +e \right ) \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right )+i \dilog \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right )-i \dilog \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right )\right )}{f}+b^{2} c \tan \left (f x +e \right )-\frac {b^{2} d e \tan \left (f x +e \right )}{f}+\frac {b^{2} d \left (\left (f x +e \right ) \tan \left (f x +e \right )+\ln \left (\cos \left (f x +e \right )\right )\right )}{f}}{f}\) | \(232\) |
default | \(\frac {a^{2} c \left (f x +e \right )-\frac {a^{2} d e \left (f x +e \right )}{f}+\frac {a^{2} d \left (f x +e \right )^{2}}{2 f}+2 a b c \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )-\frac {2 a b d e \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{f}+\frac {2 a b d \left (-\left (f x +e \right ) \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right )+\left (f x +e \right ) \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right )+i \dilog \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right )-i \dilog \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right )\right )}{f}+b^{2} c \tan \left (f x +e \right )-\frac {b^{2} d e \tan \left (f x +e \right )}{f}+\frac {b^{2} d \left (\left (f x +e \right ) \tan \left (f x +e \right )+\ln \left (\cos \left (f x +e \right )\right )\right )}{f}}{f}\) | \(232\) |
risch | \(\frac {a^{2} d \,x^{2}}{2}+a^{2} c x +\frac {2 i b^{2} \left (d x +c \right )}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {b^{2} d \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{f^{2}}-\frac {2 b^{2} d \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}-\frac {4 i b a c \arctan \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f}+\frac {4 i b a d e \arctan \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}-\frac {2 b \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right ) a d x}{f}-\frac {2 b \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right ) a d e}{f^{2}}+\frac {2 b \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right ) a d x}{f}+\frac {2 b \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right ) a d e}{f^{2}}+\frac {2 i b a d \dilog \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}-\frac {2 i b a d \dilog \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}\) | \(266\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 552 vs. \(2 (116) = 232\).
time = 3.30, size = 552, normalized size = 4.21 \begin {gather*} \frac {-2 i \, a b d \cos \left (f x + e\right ) {\rm Li}_2\left (i \, \cos \left (f x + e\right ) + \sin \left (f x + e\right )\right ) - 2 i \, a b d \cos \left (f x + e\right ) {\rm Li}_2\left (i \, \cos \left (f x + e\right ) - \sin \left (f x + e\right )\right ) + 2 i \, a b d \cos \left (f x + e\right ) {\rm Li}_2\left (-i \, \cos \left (f x + e\right ) + \sin \left (f x + e\right )\right ) + 2 i \, a b d \cos \left (f x + e\right ) {\rm Li}_2\left (-i \, \cos \left (f x + e\right ) - \sin \left (f x + e\right )\right ) + {\left (2 \, a b c f - 2 \, a b d e + b^{2} d\right )} \cos \left (f x + e\right ) \log \left (\cos \left (f x + e\right ) + i \, \sin \left (f x + e\right ) + i\right ) - {\left (2 \, a b c f - 2 \, a b d e - b^{2} d\right )} \cos \left (f x + e\right ) \log \left (\cos \left (f x + e\right ) - i \, \sin \left (f x + e\right ) + i\right ) + 2 \, {\left (a b d f x + a b d e\right )} \cos \left (f x + e\right ) \log \left (i \, \cos \left (f x + e\right ) + \sin \left (f x + e\right ) + 1\right ) - 2 \, {\left (a b d f x + a b d e\right )} \cos \left (f x + e\right ) \log \left (i \, \cos \left (f x + e\right ) - \sin \left (f x + e\right ) + 1\right ) + 2 \, {\left (a b d f x + a b d e\right )} \cos \left (f x + e\right ) \log \left (-i \, \cos \left (f x + e\right ) + \sin \left (f x + e\right ) + 1\right ) - 2 \, {\left (a b d f x + a b d e\right )} \cos \left (f x + e\right ) \log \left (-i \, \cos \left (f x + e\right ) - \sin \left (f x + e\right ) + 1\right ) + {\left (2 \, a b c f - 2 \, a b d e + b^{2} d\right )} \cos \left (f x + e\right ) \log \left (-\cos \left (f x + e\right ) + i \, \sin \left (f x + e\right ) + i\right ) - {\left (2 \, a b c f - 2 \, a b d e - b^{2} d\right )} \cos \left (f x + e\right ) \log \left (-\cos \left (f x + e\right ) - i \, \sin \left (f x + e\right ) + i\right ) + {\left (a^{2} d f^{2} x^{2} + 2 \, a^{2} c f^{2} x\right )} \cos \left (f x + e\right ) + 2 \, {\left (b^{2} d f x + b^{2} c f\right )} \sin \left (f x + e\right )}{2 \, f^{2} \cos \left (f x + e\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \sec {\left (e + f x \right )}\right )^{2} \left (c + d x\right )\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\left (a+\frac {b}{\cos \left (e+f\,x\right )}\right )}^2\,\left (c+d\,x\right ) \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________